import { reactive, toRefs } from "vue"
// api
import { librarylist } from "@/api/index"

export function useLiterature() {
    // state
    const state = reactive({
        dataList: [],
    })

    /**
     * 获取列表
     */
    const useGetLibraryList = (params) => {
        return new Promise((resolve, reject) => {
            librarylist(params).then(res => {
                state.dataList = res?.content?.data
                resolve(res)
            })
        })
    }

    return {
        ...toRefs(state),
        useGetLibraryList,
    }
}